import { IPublicTypeComponentMetadata, IPublicTypeSnippet } from '@alilc/lowcode-types';

const WeatherMeta: IPublicTypeComponentMetadata = {
  componentName: 'Weather',
  title: '天气组件',
  docUrl: '',
  screenshot: '',
  group: '首页',
  devMode: 'proCode',
  npm: {
    package: 'hzdz-charts',
    version: '0.1.0',
    exportName: 'Weather',
    destructuring: true,
    subName: ''
  },
  configure: {
    props: [
      {
        title: {
          label: '基本设置',
          tip: '天气组件的基本配置'
        },
        display: 'block',
        type: 'group',
        items: [
          {
            name: 'weatherStatus',
            title: {
              label: '天气状态',
              tip: '当前天气状态描述'
            },
            setter: 'StringSetter',
          },
          {
            name: 'weatherIcon',
            title: {
              label: '天气图标',
              tip: '天气图标类型'
            },
            setter: {
              componentName: 'SelectSetter',
              props: {
                dataSource: [
                  { label: '晴天', value: 'sunny' },
                  { label: '多云', value: 'cloudy' },
                  { label: '雨天', value: 'rainy' },
                  { label: '雪天', value: 'snowy' },
                  { label: '雾天', value: 'foggy' }
                ]
              }
            },
          },
          {
            name: 'temperature',
            title: {
              label: '温度',
              tip: '当前温度数值'
            },
            setter: 'NumberSetter',
          },
          {
            name: 'temperatureUnit',
            title: {
              label: '温度单位',
              tip: '温度显示单位'
            },
            setter: {
              componentName: 'RadioGroupSetter',
              props: {
                dataSource: [
                  { label: '摄氏度', value: '°C' },
                  { label: '华氏度', value: '°F' }
                ]
              }
            },
          },
          {
            name: 'humidity',
            title: {
              label: '湿度',
              tip: '当前湿度百分比'
            },
            setter: 'NumberSetter',
          }
        ]
      },
      {
        title: {
          label: '时间设置',
          tip: '日期和时间显示配置'
        },
        display: 'block',
        type: 'group',
        items: [
          {
            name: 'date',
            title: {
              label: '日期',
              tip: '日期显示格式 (MM.DD)'
            },
            setter: 'StringSetter',
          },
          {
            name: 'weekday',
            title: {
              label: '星期',
              tip: '星期显示'
            },
            setter: 'StringSetter',
          },
          {
            name: 'time',
            title: {
              label: '时间',
              tip: '时间显示格式 (HH:MM)'
            },
            setter: 'StringSetter',
          }
        ]
      },
      {
        title: {
          label: '事件',
          tip: '组件事件配置'
        },
        display: 'block',
        type: 'group',
        items: [
          {
            name: 'onClick',
            title: {
              label: '点击事件',
              tip: '点击天气组件时的回调函数'
            },
            setter: 'FunctionSetter',
          }
        ]
      }
    ],
    supports: {
      style: true,
      className: true,
      events: ['onClick']
    },
    component: {
      isContainer: false
    }
  }
};

const snippets: IPublicTypeSnippet[] = [
  {
    title: '*天气组件',
    screenshot: '',
    schema: {
      componentName: 'Weather',
      props: {
        weatherStatus: '晴',
        weatherIcon: 'sunny',
        temperature: 22,
        temperatureUnit: '°C',
        humidity: 93,
        date: '6.12',
        weekday: '星期四',
        time: '17:03'
      }
    }
  }
];

export default {
  ...WeatherMeta,
  snippets
}; 